package com.yc.cloud.admin.enums;

import lombok.Getter;

/**
 * 抓图类型枚举
 *
 * @author kinggu
 * @since 2025-10-10
 */
@Getter
public enum SnapshotTypeEnum {
    /**
     * 定时间隔抓图
     */
    INTERVAL("INTERVAL", "定时间隔抓图"),
    
    /**
     * 事件触发抓图
     */
    EVENT("EVENT", "事件触发抓图"),
    
    /**
     * 手动抓图
     */
    MANUAL("MANUAL", "手动抓图");

    private final String code;
    private final String desc;

    SnapshotTypeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    /**
     * 根据code获取枚举
     */
    public static SnapshotTypeEnum fromCode(String code) {
        if (code == null) {
            return null;
        }
        for (SnapshotTypeEnum type : values()) {
            if (type.code.equals(code)) {
                return type;
            }
        }
        return null;
    }
}

